package com.vishnu.jb;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.DynaActionForm;




public class UserLoginFormJB extends DynaActionForm  {
	
	public UserLoginFormJB(){
		System.out.println("UserLoginFormJB object is created..............");
	}
/*	private String name;
	private String passw;
	

public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getPassw() {
		return passw;
	}
	public void setPassw(String passw) {
		this.passw = passw;
	}*/
//public void reset(ActionMapping mapping, HttpServletRequest request){
//	System.out.println("-------------entered into reset() method---------");
	// if properties given in form and properties in FormBean are same then no need to set in reset method...if not we must set
/*	setName(request.getParameter("nam"));
	setPassw(request.getParameter("pass"));*/
//}
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request){
	System.out.println("-------------entered into validate() method---------");
	//set("name","Enter Name");
	//set("passw","Enter Password");
/*	String name=getName();
	String pwd=getPassw();*/
	
	String name=(String)get("name");
	String pwd=(String)get("passw");
	System.out.println("name:"+name);
	System.out.println("password:"+pwd);
	ActionErrors aes=new ActionErrors();
	if(name=="" || name==null){
		aes.add("nameer",new ActionMessage("nameerr"));
	}
	if(pwd=="" || pwd==null){
		aes.add("pwder",new ActionMessage("pwderr"));
	}
	
	
	return aes;
}



}
